from domains.typing import TemplateLike


class NotLoggedInError(Exception):
    """未登录的异常"""

    def __init__(self):
        self.msg = "用户未登录!"

    def __str__(self):
        return self.msg


class TemplateNotFoundError(Exception):
    """找不到模板的异常"""

    def __init__(self, tm: TemplateLike = None):
        if tm is None:
            self.msg = "找不到模板!"
        else:
            self.msg = f"找不到模板: [{tm[0]}] !"

    def __str__(self):
        return self.msg

